package jsi.ws
import groovyx.net.ws.WSClient
import jsi.ws.DictClientimport com.sun.xml.bind.v2.model.runtime.RuntimeElementclass DictClient {
	
	def WSClient proxy = null;
	
	def static dictClient = null;
	
	def protected DictClient(){
		
	}

	def static DictClient getInstance(){
		if (dictClient == null){
			dictClient = new DictClient()
			dictClient.init()
		} 
		return dictClient;
	}
	
	def String basic(String derivate){
		return proxy.basic(derivate)
	}
	
	def init(){
		if (proxy == null){
			proxy = new WSClient("http://localhost:6980/DictService?wsdl", this.class.classLoader)
			
			def okno = basic("okna")
			if (okno != "okno") {
				throw new RuntimeException("Failed okno test, probably no connection")
			}
		}
	}
}